<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>签约网</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>
</head>
<body>
<div id="secHeader">
  <header class="header">
      <a href="javascript:void(0);" onclick="api.closeWin()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
      <h2 id='catename'>资讯</h2>

  </header>
</div>
<section class="news_section">

    <div class="news_box">

        <div class="news_list" id='bigcon'>
            <ul id='con'>

            </ul>
        </div>
    </div>
    <div class="news_box" style="display: none">

        <div class="video_list">
            <ul id='video'>

            </ul>
        </div>
    </div>

</section>

<section class="fixed_nav" style="display: none">
    <ul>
        <li><a href="workbench.html"><h6 class="icon"></h6>工作台</a></li>
        <li class="active"><a href="##"><h6 class="icon"></h6>资讯</a></li>
        <li><a href="find.html"><h6 class="icon"></h6>发现</a></li>
        <li><a href="personal.html"><h6 class="icon"></h6>我的</a></li>
    </ul>
</section>


</body>

<script>

    var page=1;
    var p='';
    var para='';

    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });

        api. addEventListener({name:'scrolltobottom'}, function(ret, err){

            toDoRequest();

        });

        para=api.pageParam;

        $('#catename').html(para.catename)
        if(para.newstype == 1){
            $('#bigcon').removeClass('news_list').addClass('video_list');
        }


        toDoRequest();

        //下拉刷新
        api.setRefreshHeaderInfo({
          visible: true,
          bgColor: 'rgba(255,255,255,255)',
          textColor: '#666',
          textDown: '下拉刷新',
          textUp: '释放刷新'
        }, function(ret, err) {
          toDoRefresh();
        });
    };

    function toDoRequest(){

        p= {type:para.id,newstype:para.newstype,page:page};
        //alert(JSON.stringify(p));
        api.ajax({
                url: webSiteUrl+'/app/public/news',
                method: 'post',
                data: {
                    values: p
                }
            }, function(ret, err) {
                api.hideProgress();

                if(ret.code==200){

                    html = "";
                    var tj=ret.data;
                    if(tj != null){

                    for(var i=0;i<tj.length;i++){
                        if(para.newstype==0){
html+='<li onclick="newsdetail('+tj[i].id+')"><a href="javascript:;"><img src="'+webSiteUrl+tj[i].icon+'"><div class="news_info"><h6>'+tj[i].name+'</h6><div class="news_times"><em>'+tj[i].time+'</em><span>'+tj[i].plnum+'</span></div></div></a></li>';
                        }else{
html+='<li  onclick="newsdetail('+tj[i].id+')"><a href="javascript:;"><div class="video_box"><img src="'+webSiteUrl+tj[i].icon+'"><div class="shade"></div></div><div class="news_info"><h6>'+tj[i].name+'</h6><div class="news_times"><em>'+tj[i].time+'</em><span>'+tj[i].plnum+'</span></div></div></a></li>';
                        }



                    }
                    }
                    if(page==1){
                        $('#con').html(html);
                    }else{
                        $('#con').append(html);
                    }
                    page++;



                }else{
                    if(page==1){
                        $('#con').html('<p style="text-align:center">暂无数据</p>');
                    }

                }
            });

    }




</script>
</html>
